package com.ideal.hbase.client.core;

import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;

/**
 * 
 * @author
 *
 */
public class HbaseConfigurationFactoryBean {

	private static Configuration configuration;
	// private static final Properties properties;

	static {
		configuration = HBaseConfiguration.create();
		Properties properties = new Properties();
        try {
        	properties.load(HbaseConfigurationFactoryBean.class.getClassLoader().getResourceAsStream("hbase.properties"));
			
		} catch (Exception e) {
			e.printStackTrace();
		}

        //也可以指定键名来获取值
        //String name = properties.getProperty("name");

        Set<Entry<Object,Object>> entrySet = properties.entrySet();
        for (Entry<Object, Object> entry : entrySet) {
            configuration.set((String)entry.getKey(),(String)entry.getValue());
        }
		
	}

	public HbaseConfigurationFactoryBean() {

	}

	public static Configuration getConfiguration() {
		return configuration;
	}

}